import React, { Component } from 'react';
import  '../../style/Index/Quicklist.css'
import services from '../../api/interface'
interface Props { }
interface State {
    quicklist: quickitem[]
}
interface quickitem {
    imgurl: string, title: string
}
class Quicklist extends Component<Props, State>{
    constructor(props: Props) {
        super(props)
        this.state = {
            quicklist: [
            ]
        }
    }
    async componentDidMount(){
        var res=await services.pro.index_catelist()
        this.setState({
            quicklist:res.data.data
        })
        // console.log(res.data.data);
    }
    render() {
        return (
            <div className='quicklist'>
                {
                    this.state.quicklist.map((item, index) => {
                        return (
                            <div className="list" key={index}>
                                <img src={item.imgurl} alt="" />
                                <div className="text">
                                    {item.title}
                                </div>
                            </div>
                        )
                    })
                }
            </div>
        );
    }
}

export default Quicklist;